package com.klun.concDesign.chapterFive.Future_5_5_3;

import java.util.concurrent.Callable;

/**
 * 展示 JDK 内置的 Futrue 模式
 */
public class RealData implements Callable<String> {
    private String para;
    public RealData(String para){
        this.para = para;
    }
    @Override
    public String call() throws Exception {
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < 10; i++) {
            stringBuffer.append(para);
            try{
                // 模拟 线程处理数据的过程
                Thread.sleep(2000);
            } catch (InterruptedException e){
            }
        }
        return stringBuffer.toString();
    }
}
